/*
 * OptionsScreen.java
 *
 * Created on September 13, 2006, 3:10 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package Experience.Screens;

import Comm.Util.Logger;
import Experience.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;

/**
 *
 * @author dmgreen
 */
public class LogScreen extends Form implements CommandListener {
   
    ExpUI myMIDlet;
    
    /** Creates a new instance of OptionsScreen */
    public LogScreen(ExpUI mid) {
        super("MAHI LOG");
        
        myMIDlet = (ExpUI) mid;
        
        this.addCommand(new Command("Back", Command.BACK, 1));
        this.addCommand(new Command("Clear", Command.SCREEN, 1));
        
        // set itself as the command listener
        this.setCommandListener(this);
        
        //populateForm();
    }
    
    
    public void commandAction(Command com, Displayable dis) {
	String label = com.getLabel();
	
        if ("Back".equals(label)) {
            myMIDlet.unshowPreferencesScreen();
        }
        else if ("Clear".equals(label)) {
            Logger.getLog().clearLog();
            this.deleteAll();
            this.append(Logger.getLog().getLogMessages());
        }
        else if ("Exit".equals(label)) {
            //do nothing
        }             
    }
}
